<?php 
class UploadComponent extends Object{
	
	function _creatDir($fileDir) {
		$dirs = split("/", $fileDir);
		$path = WWW_ROOT;
		foreach ($dirs as $dir) {
			$path .= DS . $dir;
			if (!file_exists($path)) {
				@ mkdir($path, 0777);
			}
		}
	}
	
	function upload($file,$path,$filename){
		$this->_creatDir($path);
		move_uploaded_file($file, $path . '/' . $filename);
	}
}
?>